from openpyxl import load_workbook,Workbook

import time
class ToExcel:

    def __init__(self):
        self.header = ['姓名','Github账号','Gitee账号','coding.net账号']
        try:
            self.wb = load_workbook('班级账号.xlsx')
        except FileNotFoundError:
            self.wb = Workbook()
            self.sheet = self.wb.active
            self.sheet.title = '账号信息'
            for i in range(1,len(self.header)+1):
                self.sheet.cell(row=1,column = i).value = self.header[i-1]
        finally:
            self.wb.save('班级账号.xlsx')
    
